<template>
	<view class="icon_list">
		<u-grid :border="false" col="4" @click="click">
			<u-grid-item  v-for="(baseListItem, baseListIndex) in baseList"
				:key="baseListIndex">
				<view :class="baseListIndex == 4?'shenghuo':''">
					<u-icon :customStyle="{ paddingTop: 20 + 'rpx' }" :name="baseListItem.name" :size="22"></u-icon>
					<text class="grid-text">{{ baseListItem.title }}</text>
				</view>
				
			</u-grid-item>
		</u-grid>
		<guideStep :step="step"></guideStep>
	</view>
</template>

<script>
	import guideStep from "@/components/guideStep/guideStep.vue";
	export default {
		components: {
			guideStep
		},
		data() {
			return {
				step: {
					name: 'workbenchKey4',
					guideList: [{
						el: '.shenghuo',
						tips: '点击这里，可查看发布自己的生活',
						style: "border-radius: 8rpx;margin: 0",
						next: "我知道啦"
					}]
				},
				goNew: false,
				userNewCalendar: true,
				baseList: [{
						name: 'attach',
						title: '创作中心',
						path: '/pages/tabbar/mine/myopus'
					},
					{
						name: 'star',
						title: '收藏',
						path: '/pages/tabbar/mine/collection'
					},
					{
						name: 'clock',
						title: '浏览历史',
						path: '/pages/tabbar/mine/footprint'
					},
					{
						name: 'camera',
						title: '家庭日历',
						path: '/pages/calendar/index'
					},
					{
						name: 'bookmark',
						title: '我的生活',
						path: '/pages/life/index'
					},
					{
						name: 'bag',
						title: '我的草稿',
						path: '/pages/draft/index'
					},
					{
						name: 'chat',
						title: 'AI管家',
					},
					{
						name: 'coupon',
						title: '我要吐槽',
					}
				]
			};
		},
		created() {
			this.getConfig()
		},
		methods: {
			getConfig() {
				this.userNewCalendar = uni.getStorageSync('userNewCalendar')
			},
			click(name) {

				let url = this.baseList[name].path

				let title = this.baseList[name].title

				if (title == '我要吐槽') {
					// #ifdef MP-WEIXIN
					this.$emit('showfankuiDia')
					this.fankuiDia = true
					// #endif

					// #ifndef MP-WEIXIN
					let productId = 597063
					window.location = 'https://support.qq.com/product/' + productId
					// #endif

				} else if (title == '家庭日历') {
					if (this.userNewCalendar) {
						uni.navigateTo({
							url: '/pages/calendar/index2'
						})
					} else {
						uni.navigateTo({
							url: '/pages/calendar/index'
						})
					}

				} else if (title == 'AI管家') {
					uni.switchTab({
						url: '/pages/chat/index'
					})
				} else {
					uni.navigateTo({
						url
					})
				}

			}
		}
	};
</script>

<style lang="scss" scoped>
	.grid-text {
		font-size: 14px;
		padding: 10rpx 0 20rpx 0rpx;
		/* #ifndef APP-PLUS */
		box-sizing: border-box;
		/* #endif */
	}

	.icon_list {
		padding-top: 10rpx;
		background-color: #fff;
		padding-bottom: 10rpx;
	}
</style>